﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ResManager : Singleton<ResManager>
{
    private Dictionary<int, Sprite> spriteDic = new Dictionary<int, Sprite>();
    //将图集内容装成字典
    public ResManager()
    {
        Sprite[] spriteArray = Resources.LoadAll<Sprite>("2048Atlas");
        foreach (var item in spriteArray)
        {
            spriteDic.Add(int.Parse(item.name), item);
        }
    }
   //加载对应数字的图片资源
    public Sprite LoadSprite(int num)
    {
        if (spriteDic.ContainsKey(num))
            return spriteDic[num];
        return null;
    }
}
